﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace SARControlLib
{
	/// <summary>
	/// SARSpeed.xaml 的交互逻辑
	/// </summary>
	public partial class SARSpeed : UserControl
	{
		public SARSpeed()
		{
			this.InitializeComponent();
		}

        private double speedNum;
        int[] num = new int[6];

        /// <summary>
        /// 按钮上显示的文本
        /// </summary>
        public double SpeedNum
        {
            get
            {
                return speedNum;
            }
            set
            {
                speedNum = value;
                speedNum = speedNum % 10000;
                num[0] = (int)(speedNum) / 1000;
                num[1] = ( (int)(speedNum) / 100) % 10;
                num[2] = ( (int)(speedNum) / 10) % 10;
                num[3] = (int)(speedNum) % 10;
                num[4] = (int)(speedNum * 10 ) % 10;
                num[5] = (int)(speedNum * 100) % 10;

                int i = 0;
                foreach (SARNumControl p in Num.Children)
                {
                    p.ShowNum = num[i];
                    i++;
                }
            }
        }
	}
}